import Vue from "vue";
import VueRouter from "vue-router";
// import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/test",
    name: "练习",
    component: () => import("@/views/test.vue"),
  },
  {
    //首页
    path: "/login",
    name: "登录",
    component: () => import("@/views/Login.vue"),
  },
  {
    path: "/layout",
    name: "首页",
    component: () => import("@/views/Layout"),
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("@/views/HomeView.vue"),
      },
      {
        path: "/about",
        name: "about",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
      },
      {
        path: "/sys",
        name: "管理系统",
        component: () => import("@/views/sys"),
        children: [
          {
            path: "/user",
            name: "User",
            component: () => import("@/views/sys/User.vue"),
          },
          {
            path: "/plan",
            name: "Plan",
            component: () => import("@/views/sys/Plan.vue"),
          },
          {
            path: "/set",
            name: "Set",
            component: () => import("@/views/sys/Set.vue"),
          },
        ],
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
